package com.d5power.objects
{
	import com.d5power.D5Game;
	import com.d5power.controller.BaseControler;
	import com.d5power.net.D5StepLoader;
	
	import flash.display.DisplayObject;
	
	public class MovieObject extends GameObject
	{
		
		private var _shower:DisplayObject;
		
		public function MovieObject(ctrl:BaseControler=null)
		{
			objectName = 'MovieObject';
			super(ctrl);
		}
		
		public function loadMovie(res:String):void
		{
			if(_shower!=null)
			{
				if(contains(_shower)) removeChild(_shower);
				if(_shower.parent) _shower.parent.removeChild(_shower);
				_shower = null;
			}
			
			var onComplate:Function = function(obj:DisplayObject):void
			{
				_shower = obj;
				addChild(_shower);
			}
			
			D5StepLoader.me.addLoad(D5Game.me.projPath+res,onComplate,false,D5StepLoader.TYPE_SWF);
		}
	}
}